﻿
using Business.Base.DB.DBRules;

using Business.Base.Enums;
using Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Business.Base.Model
{
    [Serializable]
    public class Experiment
    {
        int id;
        String   experimentCode=null;          //试验编号
        //String   experimentName;          //试验名
        String   experimentOwner;         //试验人员
        String   filePath;                //保存路径
        ExperimentType experimentType;    // 试验类型 1.离心泵性能测试 2.螺杆泵性能测试 3.气蚀试验 4.空载试验 5.温升试验 6.负载试验 7.堵转试验
        DateTime createTime;              //试验时间
        List<ExperimentRecord> recordList = new List<ExperimentRecord>();


        /// <summary>
        /// 试验数据模板路径
        /// </summary>
        public String TempalatePath => Config.ExperimentReportTemplatePath+"\\" + experimentType.ToString() + "_Template.xlsx";

        /// <summary>
        /// 试验数据默认保存路径
        /// </summary>
        public String DefaultSavePath => experimentCode==null? "": Config.ExperimentReportDir + "\\" + experimentCode + ".xlsx";

        #region 属性
        /// <summary>
        /// 测试电流的时候，去读的三相电流，电压的地址，默认380V，读取的是平均电流，电压和功率，默认220V，读取的是第三相的电流电压和功率
        /// </summary>
        public virtual int PhassAddress { get; }

   
    

       

        /// <summary>
        /// 试验编号
        /// </summary>
        [DBFieldAttribute("experimentCode")]
        public string ExperimentCode { get => experimentCode; set => experimentCode = value; }

        /// <summary>
        /// 试验时间
        /// </summary>
        [DBFieldAttribute("createTime")]
        public DateTime CreateTime { get => createTime; set => createTime = value; }

        /// <summary>
        /// 试验人员
        /// </summary>
        [DBFieldAttribute("experimentOwner")]
        public string ExperimentOwner { get => experimentOwner; set => experimentOwner = value; }

        /// <summary>
        /// 试验类型 1.性能测试 2.气蚀试验 3.空载试验 4.温升试验 5.负载试验 6.堵转试验
        /// </summary>
        public ExperimentType ExperimentType { get => experimentType; set => experimentType = value; }
 
        /// <summary>
        /// 试验记录数据
        /// </summary>
        public  List<ExperimentRecord> RecordList { get => recordList; set => recordList = value; }

        /// <summary>
        /// 试验记录保存地址
        /// </summary>
        [DBFieldAttribute("filePath")]
        public string FilePath { get => DefaultSavePath;  }

        /// <summary>
        /// 试验id
        /// </summary>
        [DBFieldAttribute("id")]
        public int Id { get => id; set => id = value; }

        /// <summary>
        /// 试验名
        /// </summary>
        //[DBFieldAttribute("experimentName")]
       // public string ExperimentName { get => experimentName; set => experimentName = value; }
        #endregion
    }
}
